Passed
Push — master ( e13259...278427 )
by Luís
01:10
created

App.ServicesContainer.onStart   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 2
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 0
cp 0
crap 2
rs 9.4285
c 2
b 0
f 2
1
import App from "app";
2
3
// application's services
4
import Request from "./ajax/Request";
5 4
import PersistentCache from "./cache/Persistent";
6
7
// example:
8
// constructor
9
// App.ServicesContainer.define("Service", require("./Service"))
10
11
// instance
12
// App.ServicesContainer.setInstance("Service", new Service());
13
14
15
// Default services
16
// interface to handle AJAX requests
17
App.ServicesContainer.define("AJAX", Request);
18
App.ServicesContainer.define("Cache", PersistentCache);
19
20
// configure AJAX to always ask for json
21
// You can ask for a new instance do get rid of this behaviour :)
22
App.ServicesContainer.get("AJAX").onStart(req => req.set("Accept", "application/json"));
23